package org.duiduo.state;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 状态的交换
 *
 * @author liangze
 * @date 2024/2/20 11:40
 */
@Data
@NoArgsConstructor
public class StateTransaction {

    // 当前状态
    private StateEnum currentState;
    // 相对应动作
    private ActionEnum action;
    // 下一个状态
    private StateEnum nextState;
    // 相应事件
    private Event event;

    // 链式初始化对象
    public StateTransaction source(StateEnum state) {
        currentState = state;
        return this;
    }
    public StateTransaction when(ActionEnum action) {
        this.action = action;
        return this;
    }
    public StateTransaction target(StateEnum state) {
        nextState = state;
        return this;
    }
    public StateTransaction how(Event event) {
        this.event = event;
        return this;
    }
}
